Fixed an issue with IOSource#read_until when reaching the end of a file#288
Merged
kou merged 1 commit intoruby:masterfrom Sep 4, 2025
Merged
Fixed an issue with IOSource#read_until when reaching the end of a file#288kou merged 1 commit intoruby:masterfrom
IOSource#read_until when reaching the end of a file#288kou merged 1 commit intoruby:masterfrom
Conversation
kou
reviewed
Sep 3, 2025
3ed00ef to
cd1c156
Compare
IOSource#readIOSource#read_until when reaching the end of a file
kou
reviewed
Sep 4, 2025
…file ## Why? If `@source = nil` is set at the end of the file, prevent `IOSource#read_until` from raising an error. > /.gems/gems/rexml-3.4.2/lib/rexml/parsers/baseparser.rb:524:in 'REXML::Parsers::BaseParser#pull_event': #<NoMethodError: undefined method 'eof?' for nil> (REXML::ParseException) > .gems/gems/rexml-3.4.2/lib/rexml/source.rb:275:in 'REXML::IOSource#read_until' See: https://github.com/ruby/rexml/blob/185bdc737da406ba4f9564726849ad3477858eb2/lib/rexml/source.rb#L266-L276
cd1c156 to
9ddcf5c
Compare
Member
|
Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix GH-287
Why?
If
@source = nilis set at the end of the file, preventIOSource#read_untilfrom raising an error.rexml/lib/rexml/source.rb
Lines 266 to 276 in 185bdc7
IOSource#read.@scanner.rest, use@scanner.scan_until(pattern)to returnstr.@sourceisnil, an exception occurs.